package thread;

public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();//获取主线程

        String name = main.getName();//获取进程名字
        System.out.println(name);

        long id = main.getId();//获取线程的唯一标识
        System.out.println(id);

        int priority = main.getPriority();//获取线程的优先级(一个范围1-10之间的数字)
        System.out.println("优先级:" + priority);

        boolean daemon = main.isDaemon();//查看是否为守护线程
        boolean alive = main.isAlive();//查看是否活着
        boolean interrupted = main.isInterrupted();//查看是否中断
        System.out.println("是否为守护线程" + daemon);
        System.out.println("是否活着" + alive);
        System.out.println("是否被中断" + interrupted);
    }
}
